package inits

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
	"log"
	"rpc-server/basic/global"
)

func InitEs() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://14.103.168.20:9200",
		},
		// ...
	}
	global.Es, err = elasticsearch.NewClient(cfg)
	if err != nil {
		fmt.Print(err)
		return
	}
	log.Println("Es连接成功")

}
